package org.domain.sigepac.session;

import org.domain.sigepac.Utils;
import org.domain.sigepac.Entity.MotivoDestino;
import org.domain.sigepac.home.EntityHomeSupport;
import org.domain.sigepac.repository.RepositorioMotivoDestino;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.FlushModeType;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.international.StatusMessages;

@Name("motivoDestinoHome")
@Scope(ScopeType.CONVERSATION)
public class MotivoDestinoHome extends EntityHomeSupport<MotivoDestino> {


	private static final long serialVersionUID = 7698596678249602179L;

	@In
	private StatusMessages statusMessages;

	@In
	private RepositorioMotivoDestino repositorioMotivoDestino;


	public MotivoDestinoHome() {
		// TODO Auto-generated constructor stub
	}


	@Override
	protected MotivoDestino createInstance() {
		return new MotivoDestino();
	}



	public void salvar(){

		if(isManaged())
			update();
		else
			persist();

		Utils.entityManagerFlush();
	}

	@Begin(flushMode=FlushModeType.MANUAL,join=true)
	public void setIdDestino(Integer id) {
	    setId(id);

	 }

	public Integer getIdDestino() {
	    return (Integer) getId();
	  }

}
